#pragma once

#define WIN32_LEAN_AND_MEAN		// Exclude rarely-used stuff from Windows headers

// Windows Header Files:
#define NOMINMAX
#include <windows.h>
#include <windowsx.h>

#include <crtdbg.h>

#define _VS2005_
#if _MSC_VER < 1400
#	undef _VS2005_
#endif

// Visual Studio 2010 doesn't support the new C++0x final keyword.
// It does support the Microsoft-specific sealed keyword
// which acts like the C++0x final keyword.
//#define final sealed

// C RunTime Header Files
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>

#include <mmsystem.h>

#include <algorithm>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <map>

#if defined(_DEBUG)
#	define NEW new(_NORMAL_BLOCK,__FILE__, __LINE__)
#else
#	define NEW new
#endif

#define DXUT_AUTOLIB

// DirectX Includes
#include <dxut.h>
#include <d3dx9tex.h>
#include <dxut.h>
#include <SDKmisc.h>

#include <tinyxml.h>

// fast delegate stuff
#include <FastDelegate.h>

#pragma warning(disable : 4996) // 'function' declared deprecated - gets rid of all those 2005 warnings...

// Engine #includes
#include "Logger.h"  // this should be the first of the gcc includes since it defines ASSERT()
#include "Templates.h"
#include "Geometry.h"

typedef D3DXCOLOR Color;

extern Color g_white;
extern Color g_black;
extern Color g_cyan;
extern Color g_red;
extern Color g_green;
extern Color g_blue;
extern Color g_yellow;
extern Color g_gray40;
extern Color g_gray25;
extern Color g_gray65;
extern Color g_transparent;

extern Vector3 g_up;
extern Vector3 g_right;
extern Vector3 g_forward;

extern Vector4 g_up4;
extern Vector4 g_right4;
extern Vector4 g_forward4;

struct AppMsg
{
	HWND m_hWnd;
	UINT m_uMsg;
	WPARAM m_wParam;
	LPARAM m_lParam;
};

#include "Interfaces.h"

// Useful #defines
extern const float fOPAQUE;
extern const float fTRANSPARENT;

extern const int MEGABYTE;
extern const float SIXTY_HERTZ;

extern const int SCREEN_WIDTH;
extern const int SCREEN_HEIGHT;

#if !defined(SAFE_DELETE)
#	define SAFE_DELETE(x) if(x) delete x; x = NULL;
#endif

#if !defined(SAFE_DELETE_ARRAY)
#	define SAFE_DELETE_ARRAY(x) if (x) delete [] x; x = NULL; 
#endif

#if !defined(SAFE_RELEASE)
#	define SAFE_RELEASE(x) if(x) x->Release(); x = NULL;
#endif

#ifdef UNICODE
#	define _tcssprintf wsprintf
#	define tcsplitpath _wsplitpath
#else
#	define _tcssprintf sprintf
#	define tcsplitpath _splitpath
#endif

#define __STR2__(x) #x
#define __STR1__(x) __STR2__(x)
#define __LOC__ __FILE__ "("__STR1__(__LINE__)") : Warning Msg: "

#include "GameApp.h"

extern INT WINAPI Carbonado(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow);